package com.cy.jt.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cy.jt.mapper.ItemCatParamMapper;
import com.cy.jt.pojo.ItemCatParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @description:
 * @author: LiuXingYu
 * @date: 2021/8/6 16:51
 */
@Service
public class ItemCatParamServiceImpl implements ItemCatParamService{

    @Autowired
    private ItemCatParamMapper itemCatParamMapper;

    @Override
    public List<ItemCatParam> findItemCatParamListByType(ItemCatParam itemCatParam) {

        return itemCatParamMapper.selectList(new QueryWrapper<>(itemCatParam));
    }

    @Override
    @Transactional  //事务控制
    public void addItemCatParam(ItemCatParam itemCatParam) {
        itemCatParamMapper.insert(itemCatParam);
    }

    @Override
    public void deleteItemCatParamById(Integer paramId) {
        itemCatParamMapper.deleteById(paramId);
    }

    @Override
    @Transactional // 更新操作时,要添加事务操作
    public void updateItemCatParam(ItemCatParam itemCatParam) {
        itemCatParamMapper.updateById(itemCatParam);
    }

}
